﻿using System;
using System.Collections.Generic;
using System.Text;
using Entity;
using System.Data;

namespace Service
{
    public static class Table2Entity_Service
    {
        public static List<City> Bin_City(DataTable dt)
        {
            List<City> list = new List<City>();
            foreach (DataRow dr in dt.Rows)
            {
                City model = new City();
                model.Name = dr["Name"].ToString();
                model.Code = dr["Code"].ToString();
                model.OrderNum = Convert.ToInt32(dr["OrderNum"]);
                list.Add(model);
            }
            return list;
        }
        public static List<Keyword> Bin_Keyword(DataTable dt)
        {
            List<Keyword> list = new List<Keyword>();
            foreach (DataRow dr in dt.Rows)
            {
                Keyword model = new Keyword();
                model.Name = dr["Name"].ToString();
                model.OrderNum = Convert.ToInt32(dr["OrderNum"]);
                model.Page_From = Convert.ToInt32(dr["Page_From"]);
                model.Page_To = Convert.ToInt32(dr["Page_To"]);
                list.Add(model);
            }
            return list;
        }
    }
}
